<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>dadi.PhiManip</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://dadi.googlecode.com">dadi</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="dadi-module.html">Package&nbsp;dadi</a> ::
        Module&nbsp;PhiManip
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="dadi.PhiManip-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module PhiManip</h1><p class="nomargin-top"><span class="codelink"><a href="dadi.PhiManip-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">

Manipulating population frequency spectra phi. e.g. population splittings and
admixture

</pre>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_1D" class="summary-sig-name">phi_1D</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">nu</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">theta0</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">gamma</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">h</span>=<span class="summary-sig-default">0.5</span>,
        <span class="summary-sig-arg">theta</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">beta</span>=<span class="summary-sig-default">1</span>)</span><br />
      One-dimensional phi for a constant-sized population with genic selection.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_1D_genic" class="summary-sig-name">phi_1D_genic</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">nu</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">theta0</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">gamma</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">theta</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">beta</span>=<span class="summary-sig-default">1</span>)</span><br />
      One-dimensional phi for a constant-sized population with genic selection.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_genic">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_1D_snm" class="summary-sig-name">phi_1D_snm</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">nu</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">theta0</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">theta</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">beta</span>=<span class="summary-sig-default">1</span>)</span><br />
      Standard neutral one-dimensional probability density.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_snm">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_1D_to_2D" class="summary-sig-name">phi_1D_to_2D</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">phi_1D</span>)</span><br />
      Implement a one-to-two population split.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_to_2D">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_2D_to_3D_split_2" class="summary-sig-name">phi_2D_to_3D_split_2</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">phi_2D</span>)</span><br />
      Split population 2 into populations 2 and 3.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_split_2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_2D_to_3D_split_1" class="summary-sig-name">phi_2D_to_3D_split_1</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">phi_2D</span>)</span><br />
      Split population 1 into populations 1 and 3.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_split_1">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_admixture_intermediates"></a><span class="summary-sig-name">_admixture_intermediates</span>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">ad_z</span>,
        <span class="summary-sig-arg">zz</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#_admixture_intermediates">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_two_pop_admixture_intermediates"></a><span class="summary-sig-name">_two_pop_admixture_intermediates</span>(<span class="summary-sig-arg">phi_2D</span>,
        <span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>)</span><br />
      Intermediate results used when splitting a new population out from a 2D phi.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#_two_pop_admixture_intermediates">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#_three_pop_admixture_intermediates" class="summary-sig-name" onclick="show_private();">_three_pop_admixture_intermediates</a>(<span class="summary-sig-arg">phi_3D</span>,
        <span class="summary-sig-arg">f1</span>,
        <span class="summary-sig-arg">f2</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>,
        <span class="summary-sig-arg">ww</span>)</span><br />
      Intermediate results used when splitting a new population out from a 3D phi.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#_three_pop_admixture_intermediates">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_2D_to_3D_admix" class="summary-sig-name">phi_2D_to_3D_admix</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>)</span><br />
      Create population 3 admixed from populations 1 and 2.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_admix">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_2D_admix_1_into_2" class="summary-sig-name">phi_2D_admix_1_into_2</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>)</span><br />
      Admix population 1 into population 2.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_admix_1_into_2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_2D_admix_2_into_1" class="summary-sig-name">phi_2D_admix_2_into_1</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>)</span><br />
      Admix population 2 into population 1.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_admix_2_into_1">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_3D_admix_1_and_2_into_3" class="summary-sig-name">phi_3D_admix_1_and_2_into_3</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f1</span>,
        <span class="summary-sig-arg">f2</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>)</span><br />
      Admix populations 1 and 2 into population 3.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_1_and_2_into_3">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_3D_admix_1_and_3_into_2" class="summary-sig-name">phi_3D_admix_1_and_3_into_2</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f1</span>,
        <span class="summary-sig-arg">f3</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>)</span><br />
      Admix populations 1 and 3 into population 2.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_1_and_3_into_2">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_3D_admix_2_and_3_into_1" class="summary-sig-name">phi_3D_admix_2_and_3_into_1</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">f2</span>,
        <span class="summary-sig-arg">f3</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">yy</span>,
        <span class="summary-sig-arg">zz</span>)</span><br />
      Admix populations 2 and 3 into population 1.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_2_and_3_into_1">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#remove_pop" class="summary-sig-name">remove_pop</a>(<span class="summary-sig-arg">phi</span>,
        <span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">popnum</span>)</span><br />
      Remove a population from phi.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#remove_pop">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="dadi.PhiManip-module.html#phi_1D_X" class="summary-sig-name">phi_1D_X</a>(<span class="summary-sig-arg">xx</span>,
        <span class="summary-sig-arg">nu</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">theta0</span>=<span class="summary-sig-default">1.0</span>,
        <span class="summary-sig-arg">gamma</span>=<span class="summary-sig-default">0</span>,
        <span class="summary-sig-arg">h</span>=<span class="summary-sig-default">0.5</span>,
        <span class="summary-sig-arg">beta</span>=<span class="summary-sig-default">1</span>,
        <span class="summary-sig-arg">alpha</span>=<span class="summary-sig-default">1</span>)</span><br />
      One-dimensional phi for a constant-sized population with genic selection.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_X">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'dadi'"><code class="variable-quote">'</code><code class="variable-string">dadi</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="phi_1D"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_1D</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">nu</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">theta0</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">gamma</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">h</span>=<span class="sig-default">0.5</span>,
        <span class="sig-arg">theta</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">beta</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

One-dimensional phi for a constant-sized population with genic selection.

xx: one-dimensional grid of frequencies upon which phi is defined
nu: size of this population, relative to the reference population size Nref.
theta0: scaled mutation rate, equal to 4*Nref * u, where u is the mutation 
        event rate per generation for the simulated locus and Nref is the 
        reference population size.
gamma: scaled selection coefficient, equal to 4*Nref * s, where s is the
       selective advantage.
h: Dominance coefficient. If A is the selected allele, the aa has fitness 1,
   aA has fitness 1+2sh and AA has fitness 1+2s. h = 0.5 corresonds to
   genic selection.
theta: deprecated in favor of distinct nu and theta0 arguments, for 
       consistency with Integration functions.

Returns a new phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_1D_genic"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_1D_genic</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">nu</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">theta0</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">gamma</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">theta</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">beta</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_genic">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

One-dimensional phi for a constant-sized population with genic selection.

xx: one-dimensional grid of frequencies upon which phi is defined
nu: size of this population, relative to the reference population size Nref.
theta0: scaled mutation rate, equal to 4*Nref * u, where u is the mutation 
        event rate per generation for the simulated locus and Nref is the 
        reference population size.
gamma: scaled selection coefficient, equal to 4*Nc * s, where s is the
       selective advantage.
theta: deprecated in favor of distinct nu and theta0 arguments, for 
       consistency with Integration functions.

Returns a new phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_1D_snm"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_1D_snm</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">nu</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">theta0</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">theta</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">beta</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_snm">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Standard neutral one-dimensional probability density.

xx: one-dimensional grid of frequencies upon which phi is defined
nu: size of this population, relative to the reference population size Nref.
theta0: scaled mutation rate, equal to 4*Nref * u, where u is the mutation 
        event rate per generation for the simulated locus and Nref is the 
        reference population size.
theta: deprecated in favor of distinct nu and theta0 arguments, for 
       consistency with Integration functions.

Returns a new phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_1D_to_2D"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_1D_to_2D</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">phi_1D</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_to_2D">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Implement a one-to-two population split.

xx: one-dimensional grid of frequencies upon which phi is defined
phi1D: initial probability density

Returns a new two-dimensional phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_2D_to_3D_split_2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_2D_to_3D_split_2</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">phi_2D</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_split_2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Split population 2 into populations 2 and 3.

xx: one-dimensional grid of frequencies upon which phi is defined
phi2D: initial probability density

Returns a new three-dimensional phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_2D_to_3D_split_1"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_2D_to_3D_split_1</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">phi_2D</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_split_1">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Split population 1 into populations 1 and 3.

xx: one-dimensional grid of frequencies upon which phi is defined
phi2D: initial probability density

Returns a new three-dimensional phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_three_pop_admixture_intermediates"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_three_pop_admixture_intermediates</span>(<span class="sig-arg">phi_3D</span>,
        <span class="sig-arg">f1</span>,
        <span class="sig-arg">f2</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>,
        <span class="sig-arg">zz</span>,
        <span class="sig-arg">ww</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#_three_pop_admixture_intermediates">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Intermediate results used when splitting a new population out from a 3D phi.

ww: frequency mapping for the new population.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_2D_to_3D_admix"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_2D_to_3D_admix</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>,
        <span class="sig-arg">zz</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_to_3D_admix">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Create population 3 admixed from populations 1 and 2.

Returns a 3D sfs of shape (len(xx),len(yy),len(zz))

phi:   phi corresponding to original 2 populations
f:     Fraction of population 3 derived from population 1. (A fraction 1-f
         will be derived from population 2.)
xx,yy: Mapping of points in phi to frequencies in populations 1 and 2.
zz:    Frequency mapping that will be used along population 3 axis.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_2D_admix_1_into_2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_2D_admix_1_into_2</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_admix_1_into_2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Admix population 1 into population 2.

Alters phi in place and returns the new version.

phi:   phi corresponding to original 2 populations
f:     Fraction of updated population 2 to be derived from population 1. 
         (A fraction 1-f will be derived from the original population 2.)
xx,yy: Mapping of points in phi to frequencies in populations 1 and 2.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_2D_admix_2_into_1"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_2D_admix_2_into_1</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_2D_admix_2_into_1">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Admix population 2 into population 1.

Alters phi in place and returns the new version.

phi:   phi corresponding to original 2 populations
f:     Fraction of updated population 1 to be derived from population 2. 
         (A fraction 1-f will be derived from the original population 1.)
xx,yy: Mapping of points in phi to frequencies in populations 1 and 2.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_3D_admix_1_and_2_into_3"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_3D_admix_1_and_2_into_3</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f1</span>,
        <span class="sig-arg">f2</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>,
        <span class="sig-arg">zz</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_1_and_2_into_3">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Admix populations 1 and 2 into population 3.

Alters phi in place and returns the new version.

phi:      phi corresponding to original 3 populations.
f1:       Fraction of updated population 3 to be derived from population 1. 
f2:       Fraction of updated population 3 to be derived from population 2. 
          A fraction (1-f1-f2) will be derived from the original pop 3.
xx,yy,zz: Mapping of points in phi to frequencies in populations 1,2 and 3.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_3D_admix_1_and_3_into_2"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_3D_admix_1_and_3_into_2</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f1</span>,
        <span class="sig-arg">f3</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>,
        <span class="sig-arg">zz</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_1_and_3_into_2">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Admix populations 1 and 3 into population 2.

Alters phi in place and returns the new version.

phi:      phi corresponding to original 3 populations.
f1:       Fraction of updated population 2 to be derived from population 1. 
f3:       Fraction of updated population 2 to be derived from population 3. 
          A fraction (1-f1-f3) will be derived from the original pop 2.
xx,yy,zz: Mapping of points in phi to frequencies in populations 1,2 and 3.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_3D_admix_2_and_3_into_1"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_3D_admix_2_and_3_into_1</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">f2</span>,
        <span class="sig-arg">f3</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">yy</span>,
        <span class="sig-arg">zz</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_3D_admix_2_and_3_into_1">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Admix populations 2 and 3 into population 1.

Alters phi in place and returns the new version.

phi:      phi corresponding to original 3 populations.
f2:       Fraction of updated population 1 to be derived from population 2. 
f3:       Fraction of updated population 1 to be derived from population 3. 
          A fraction (1-f2-f3) will be derived from the original pop 1.
xx,yy,zz: Mapping of points in phi to frequencies in populations 1,2 and 3.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="remove_pop"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">remove_pop</span>(<span class="sig-arg">phi</span>,
        <span class="sig-arg">xx</span>,
        <span class="sig-arg">popnum</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#remove_pop">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Remove a population from phi.

Returns new phi with one fewer population.

phi: phi corresponding to original populations
xx: Mapping of points in phi to frequencies in population to be removed
popnum: Population number to remove, numbering from 1.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="phi_1D_X"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">phi_1D_X</span>(<span class="sig-arg">xx</span>,
        <span class="sig-arg">nu</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">theta0</span>=<span class="sig-default">1.0</span>,
        <span class="sig-arg">gamma</span>=<span class="sig-default">0</span>,
        <span class="sig-arg">h</span>=<span class="sig-default">0.5</span>,
        <span class="sig-arg">beta</span>=<span class="sig-default">1</span>,
        <span class="sig-arg">alpha</span>=<span class="sig-default">1</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="dadi.PhiManip-pysrc.html#phi_1D_X">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

One-dimensional phi for a constant-sized population with genic selection.

xx: one-dimensional grid of frequencies upon which phi is defined
nu: size of this population, relative to the reference population size Nref.
theta0: scaled mutation rate, equal to 4*Nref * u, where u is the mutation 
        event rate per generation for the simulated locus and Nref is the 
        reference population size.
gamma: scaled selection coefficient, equal to 4*Nref * s, where s is the
       selective advantage.
h: Dominance coefficient. If A is the selected allele, the aa has fitness 1,
   aA has fitness 1+2sh and AA has fitness 1+2s. Male carriers have fitness
   1+2s. h = 0.5 corresonds to genic selection.

Returns a new phi array.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://dadi.googlecode.com">dadi</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    <a href="epydoc-log.html">Generated by Epydoc
    3.0.1 on Fri Dec 14 15:16:34 2012</a>
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
